package VacationHomework.LeetCode;

public class Num263 {
    public static boolean isUgly(int n) {
        while (n>0) {
            if (n % 2 == 0) {
                n /= 2;
            } else if (n % 3 == 0) {
                n /= 3;
            } else if (n % 5 == 0) {
                n /= 5;
            } else {//当n=1时跳出循环，避免死循环
                break;
            }
        }
            return n == 1;


    }
}
